package electrycity;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

public class ElePartitioner extends Partitioner<Text, Text> {
    public int getPartition(Text key, Text value, int numPartitions) {
        //value:map输出类型 key：map输出 numpartition：分区数量
        String year = key.toString();    //确定年份
        if (year.equals("2006") || year.equals("2010")) {
            return 0;
        } else {
            return 1;
        }
    }

}
